package de.tum.in.far.threedui.general;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Geometry;
import javax.media.j3d.LineArray;
import javax.media.j3d.Shape3D;
import javax.vecmath.Color3f;
import javax.vecmath.Point3f;


public class CoordinatesMarker extends Shape3D{
	
	LineArray axes ;
	public CoordinatesMarker()
	{
		axes = new LineArray(6, LineArray.COORDINATES | LineArray.COLOR_3);
		//x axis
		axes.setCoordinate(0, new Point3f(0,0,0));
		axes.setCoordinate(1, new Point3f(.1f,0,0));
		axes.setColor(0, new Color3f(1,0,0));
		axes.setColor(1, new Color3f(1,0,0));
		
		//y axis
		axes.setCoordinate(2, new Point3f(0,0,0));
		axes.setCoordinate(3, new Point3f(0,.1f,0));
		axes.setColor(2, new Color3f(0,1,0));
		axes.setColor(3, new Color3f(0,1,0));
		
		//z axis
		axes.setCoordinate(4, new Point3f(0,0,0));
		axes.setCoordinate(5, new Point3f(0,0,.1f));
		axes.setColor(4, new Color3f(0,0,1));
		axes.setColor(5, new Color3f(0,0,1));
		
		setGeometry(axes);
	}
	
	public static BranchGroup asBranchGroup(CoordinatesMarker cm)
	{
		BranchGroup gp = new BranchGroup();
		gp.addChild(cm);
		return gp;
	}
	

	public BranchGroup asBranchGroup()
	{
		BranchGroup gp = new BranchGroup();
		gp.addChild(this);
		return gp;
	}
}
